#include <allegro.h>

int main() 
{

BITMAP *Buffer;




BITMAP *img0;
BITMAP *img1;
BITMAP *img2;
BITMAP *img3;
BITMAP *img4;
BITMAP *img5;
BITMAP *img6;

int menu=(-1);
int inmenu=1;
int a=0;
//int continuer=1 ;	

/* General initialization function */
allegro_init();
install_keyboard();
	set_color_depth(16);
	if (install_keyboard() == -1) {
		allegro_message("Error! %s", allegro_error);
		return (-1);
	}
set_color_depth(24);
if (set_gfx_mode(GFX_AUTODETECT_FULLSCREEN, 1280, 720, 0, 0) != 0) {
set_gfx_mode(GFX_TEXT, 0, 0, 0, 0); /* here’s the command for text mode */
allegro_message("Unable to initialize video mode!\n%s\n", allegro_error);
return 1;
}


Buffer = create_bitmap(1280, 720);
img0= load_bitmap("./menu_pause1.bmp", NULL);
img1= load_bitmap("./menu_pause2.bmp", NULL);
img2= load_bitmap("./menu_pause3.bmp", NULL);
img3= load_bitmap("./menu_pause4.bmp", NULL);
img4= load_bitmap("./menu_pause5.bmp", NULL);
img5= load_bitmap("./commande.bmp", NULL);
img6= load_bitmap("./nehl.bmp", NULL);

	blit(img0, Buffer, 0, 0, 0, 0, img0->w, img0->h);	
	blit(Buffer, screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H);



	while (!key[KEY_ESC]) {

	clear_bitmap(Buffer);

	if(  key[KEY_DOWN] && (inmenu==1) )	
	{menu++;
	

		if (menu==0)
		{	
	
	blit(img0, Buffer, 0, 0, 0, 0, img0->w, img0->h);	
	blit(Buffer, screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H);
a=1;
	}
	else if (menu==2)
	{

	blit(img2, Buffer, 0, 0, 0, 0, img2->w, img2->h);	
	blit(Buffer, screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H);
a=2;
	}
	else if (menu==1)
	{	
	blit(img1, Buffer, 0, 0, 0, 0, img1->w, img1->h);	
	blit(Buffer, screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H);	
a=3;
	}
if (menu==3)
	{	
	
	blit(img3, Buffer, 0, 0, 0, 0, img3->w, img3->h);	
	blit(Buffer, screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H);
a=4;
	}
if (menu==4)
		{
menu=(-1);
	
	
	blit(img4, Buffer, 0, 0, 0, 0, img4->w, img4->h);	
	blit(Buffer, screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H);
a=5;
	}
	


clear_keybuf();
readkey();
}

		if(  key[KEY_ENTER] && (a==2) )
{	


	blit(img5, Buffer, 0, 0, 0, 0, img5->w, img5->h);	
	blit(Buffer, screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H);	

}
		if(  key[KEY_ENTER] && (a==3) )
{	


	blit(img6, Buffer, 0, 0, 0, 0, img6->w, img6->h);	
	blit(Buffer, screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H);	

}

}
	destroy_bitmap(img0); //Release the bitmap data
	destroy_bitmap(img1); //Release the bitmap data
	destroy_bitmap(img2); //Release the bitmap data 
        destroy_bitmap(img3); //Release the bitmap data
        destroy_bitmap(img4); //Release the bitmap data
	destroy_bitmap(Buffer);

return 0;


}
